//
//  RCUserDataModel.m
//  RocketProject
//
//  Created by chen jiedan on 13-8-21.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "RCUserDataModel.h"
#import "KFObjectExtension.h"

@implementation RCUserDataModel

@end



@implementation RCUserProfileModel

@synthesize userAvata = _userAvata;
@synthesize userCheckInCount = _userCheckInCount;
@synthesize userName = _userName;
@synthesize userCommentCount = _userCommentCount;
@synthesize userPhotoCount = _userPhotoCount;
@synthesize liveCity       = _liveCity;
@synthesize liveCityID     = _liveCityID;
@synthesize hasFocused     = _hasFocused;
- (void) dealloc
{
    KF_RELEASE_SAFELY(_userAvata);
    KF_RELEASE_SAFELY(_userName);
    KF_RELEASE_SAFELY(_liveCity);
    [super dealloc];
}


+ (id) parseDataFromJSON:(NSDictionary *)data
{
    if (data == nil) {
        return nil;
    }
    RCUserProfileModel *retObj = [[[RCUserProfileModel alloc] init] autorelease];
    NSDictionary *dic = [data dictionaryValueForKey:@"data" defaultValue:nil];
    retObj.userName = [dic stringValueForKey:@"username" defaultValue:@"" operation:NSStringOperationTypeNone];
    retObj.userAvata = [dic stringValueForKey:@"avatar" defaultValue:@"" operation:NSStringOperationTypeNone];
    retObj.liveCity = [dic stringValueForKey:@"livecity" defaultValue:@"" operation:NSStringOperationTypeNone];
    retObj.liveCityID = [dic stringValueForKey:@"cityid" defaultValue:@"" operation:NSStringOperationTypeNone];

    NSString *sexString = [dic stringValueForKey:@"sex" defaultValue:@"男" operation:NSStringOperationTypeNone];
    NSInteger statusInt = [dic intValueForKey:@"status" defaultValue:1];
    if (statusInt == 1) {
        retObj.hasFocused = NO;
    }else{
        retObj.hasFocused = YES;
    }
    
    if ([sexString isEqualToString:@"男"]) {
        retObj.isMan = YES;
    }else{
        retObj.isMan = NO;
    }
    retObj.userCheckInCount = [dic intValueForKey:@"signin" defaultValue:0];
    retObj.userCommentCount = [dic intValueForKey:@"review" defaultValue:0];
    retObj.userPhotoCount = [dic intValueForKey:@"photo" defaultValue:0];
    return retObj;
    
}
@end